import logging
from abc import ABC, abstractmethod
from typing import Any, Callable, Dict, Generic, Optional, Type, TypeVar, List
from pydantic import BaseModel
from .fields import FieldInfo

logger = logging.getLogger(__name__)

class PluginInfo(BaseModel):
    """
    Represents information about a plugin.

    Attributes:
        plugin_name (str): The name of the plugin.
        plugin_class_name (str): The name of the plugin's class.
        plugin_module_name (str): The name of the module containing the plugin.
        plugin_class_param_name (str): The parameter name for the plugin's class.
        plugin_description (str): A description of the plugin.
        plugin_fields (Dict[str, FieldInfo]): A dictionary of fields associated with the plugin.
    """
    plugin_name: str
    plugin_class_name: str
    plugin_module_name: str
    plugin_class_param_name: str
    plugin_description: str
    plugin_fields: Dict[str, FieldInfo]

    #TODO: check hash no has fields is business ok
    def __hash__(self):
        return hash((self.plugin_name, self.plugin_class_name, self.plugin_module_name,
                     self.plugin_class_param_name, self.plugin_description))

class PluginInvokeParams(BaseModel):
    """
    Represents parameters for invoking a plugin.

    Attributes:
        plugin_cls_param_name (str): The parameter name for the plugin's class.
        plugin_name (str): The name of the plugin.
        param (Dict[str, Any]): A dictionary of parameters for the plugin.
    """
    plugin_cls_param_name: str
    plugin_name: str
    param: Dict[str, Any]

#TODO: add clean interface function
class PluginObject(ABC):
    """
    An abstract base class representing a plugin object.
    """
    pass


